package util;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.OutputStream;

public class DownloadTool {

  //通用下载
  public static void download(String filePath) {

    try {
      BufferedInputStream br = new BufferedInputStream(new FileInputStream(new File(filePath)));
      byte[] buf = new byte[1024];
      int len = 0;

      OutputStream out = new FileOutputStream(new File("D:\\test.csv"));
        while ((len = br.read(buf)) > 0) {
            out.write(buf, 0, len);
        }
      br.close();
      out.close();

    } catch (Exception e) {
      e.printStackTrace();
    }
  }


  public static void main(String[] args) {

    String filePath = "D:\\tool\\mc.exe";
    download(filePath);
  }
}
